<template>
    <div>
        <div class="search">
            <input type="text" v-model="value" @keyup.enter="submit" placeholder="衣服">
            <div class="btn" @click="cancel">取消</div>
        </div>
        <div class="hotList">
            <div class="title">热门搜索</div>
            <div class="list">
                <ul>
                    <li v-for="(item,index) in hot" :key="index" @click="searchFun(item)">{{item}}</li>
                </ul>
            </div>
            <div class="mogu">
                <div class="title">MOGU热搜</div>
                <div class="mogulist">
                    <ul>
                        <li>
                            <div class="imgbox">
                                <img src="https://s5.mogucdn.com/mlcdn/c45406/200510_7263e75632gdf8chkeg9a6l3g9la0_3999x5999.jpg_640x854.v1cAC.40.webp" alt="">
                                <span style="background: #F8473C;">1</span>
                            </div>
                            <div class="titlebox">
                                <div>恰到好处的高温露父穿搭指南>></div>
                                <div>90796</div>
                            </div>
                        </li>
                        <li>
                            <div class="imgbox">
                                <img src="https://s5.mogucdn.com/mlcdn/c45406/200510_7263e75632gdf8chkeg9a6l3g9la0_3999x5999.jpg_640x854.v1cAC.40.webp" alt="">
                                <span style="background: #E8800D;">2</span>
                            </div>
                            <div class="titlebox">
                                <div>恰到好处的高温露父穿搭指南>></div>
                                <div>90796</div>
                            </div>
                        </li>
                        <li>
                            <div class="imgbox">
                                <img src="https://s5.mogucdn.com/mlcdn/c45406/200510_7263e75632gdf8chkeg9a6l3g9la0_3999x5999.jpg_640x854.v1cAC.40.webp" alt="">
                                <span style="background: #F0C008;">3</span>
                            </div>
                            <div class="titlebox">
                                <div>恰到好处的高温露父穿搭指南>></div>
                                <div>90796</div>
                            </div>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
export default {
    data() {
        return {
            value:"",
            hot:['新人限时福利','凉鞋','短裤','裙子','短袖','睡衣','拖鞋','半身裙','防嗮衣']
        }
    },
    methods:{
        submit(){
            this.$router.push({path:"/goodslist",query:{name:this.value}})
        },
        searchFun(item){
            this.value = item
            let _this = this
            setTimeout(function() {
                _this.submit()
            },500)
        },
        cancel(){
            this.value = ""
            this.$router.go(-1)
        }
    }
}
</script>


<style lang="less" scoped>
    .mogu{
        margin-top: 50px;
        .title{
            font-size: 18px;
        }
        .mogulist{
            background: #fff;
            padding: 20px;
            border-radius: 20px;
            ul{
                li{
                    display: flex;
                    margin: 10px 0px;
                    .imgbox{
                        flex: 1;
                        height: 80px;
                        border-radius: 10px;
                        overflow: hidden;
                        position: relative;
                        img{
                            width: 100%;
                            height: 100%;
                        }
                        span{
                            position: absolute;
                            left: 0px;
                            width: 30px;
                            height: 30px;
                            text-align: center;
                            color: #fff;
                            font-size: 24px;
                        }
                    }
                    .titlebox{
                        flex: 4;
                        margin-left: 20px;
                        div:nth-child(1){
                            margin-top: 10px; 
                        }
                        div:nth-child(2){
                            color: #FF4466; 
                        }
                    }
                }
            }
        }
    }
    .hotList{
        margin: 20px;
        .title{
            font-weight: bolder;
            font-size: 18px;
        }
        .list{
            font-size: 16px;
            ul{
                li{
                    display: inline-block;
                    background: #fff;
                    padding: 6px 12px;
                    margin: 10px;
                    border-radius: 30px;
                }
            }
        }
    }
    .search{
        padding: 20px;
        // background: pink;
        display: flex;
        color: #999;
        input{
            flex: 1;
            margin-right: 10px;
            border: none;
            border-radius: 20px;
            text-indent: 1em;
            font-size: 18px;
        }
        .btn{
            // font-size: 20px;
            text-align: center;
        }
    }
    body{
        background: #F9F9F9;
    }
</style>